#include "fabrics.h"

LaneChannelStoreFabricBusSender::LaneChannelStoreFabricBusSender(JObject *parent) :
    LanePortSender(parent),
    data(new PortOut<std::complex<float>>(this)),
    addr(new PortOut<int>(this))
{
}

void LaneChannelStoreFabricBusSender::connect(LaneChannelStoreFabricBusReceiver *sender)
{
    data->connect(sender->data);
    addr->connect(sender->addr);
}

void LaneChannelStoreFabricBusSender::put(std::complex<float> data_data, int data_addr)
{
    data->put(data_data);
    addr->put(data_addr);
}

void LaneChannelStoreFabricBusSender::put_bypass(LaneChannelStoreFabricBusReceiver *receiver)
{
    data->put(receiver->data->get());
    addr->put(receiver->addr->get());
}

bool LaneChannelStoreFabricBusSender::is_any_full()
{
    return data->is_full() || addr->is_full();
}

LaneChannelStoreFabricBusReceiver::LaneChannelStoreFabricBusReceiver(JObject *parent) :
    LanePortReceiver(parent),
    data(new PortIn<std::complex<float>>(this, -1)),
    addr(new PortIn<int>(this, -1))
{
}

LaneChannelStoreFabricBusPack LaneChannelStoreFabricBusReceiver::get()
{
    LaneChannelStoreFabricBusPack tmp_884998216;
    tmp_884998216.data = data->get();
    tmp_884998216.addr = addr->get();
    return tmp_884998216;
}

bool LaneChannelStoreFabricBusReceiver::is_any_empty()
{
    return data->is_empty() || addr->is_empty();
}

bool LaneChannelStoreFabricBusReceiver::is_any_full()
{
    return data->is_full() || addr->is_full();
}

ChannelStoreFabricSender::ChannelStoreFabricSender(JObject *parent) :
    ChannelPortSender(parent),
     Bus(new LaneChannelStoreFabricBusSender(this))
{
}

ChannelStoreFabricReceiver::ChannelStoreFabricReceiver(JObject *parent) :
    ChannelPortReceiver(parent),
    Bus(new LaneChannelStoreFabricBusReceiver(this))
{
}

void ChannelStoreFabric::connect(ChannelStoreFabricSender *sender, ChannelStoreFabricReceiver *receiver)
{
    sender->Bus->connect(receiver->Bus);
}

LaneChannelLoadFabricBusSender::LaneChannelLoadFabricBusSender(JObject *parent) :
    LanePortSender(parent),
    data(new PortOut<std::complex<float>>(this)),
    addr(new PortOut<int>(this)),
    pid(new PortOut<int>(this)),
    sb_addr(new PortOut<int>(this)),
    ain_addr(new PortOut<int>(this)),
    clr(new PortOut<bool>(this))
{
}

void LaneChannelLoadFabricBusSender::connect(LaneChannelLoadFabricBusReceiver *sender)
{
    data->connect(sender->data);
    addr->connect(sender->addr);
    pid->connect(sender->pid);
    sb_addr->connect(sender->sb_addr);
    ain_addr->connect(sender->ain_addr);
    clr->connect(sender->clr);
}

void LaneChannelLoadFabricBusSender::put(std::complex<float> data_data, int data_addr, int data_pid, int data_sb_addr, int data_ain_addr, bool data_clr)
{
    data->put(data_data);
    addr->put(data_addr);
    pid->put(data_pid);
    sb_addr->put(data_sb_addr);
    ain_addr->put(data_ain_addr);
    clr->put(data_clr);
}

void LaneChannelLoadFabricBusSender::put_bypass(LaneChannelLoadFabricBusReceiver *receiver)
{
    data->put(receiver->data->get());
    addr->put(receiver->addr->get());
    pid->put(receiver->pid->get());
    sb_addr->put(receiver->sb_addr->get());
    ain_addr->put(receiver->ain_addr->get());
    clr->put(receiver->clr->get());
}

bool LaneChannelLoadFabricBusSender::is_any_full()
{
    return data->is_full() || addr->is_full() || pid->is_full() || sb_addr->is_full() || ain_addr->is_full() || clr->is_full();
}

LaneChannelLoadFabricBusReceiver::LaneChannelLoadFabricBusReceiver(JObject *parent) :
    LanePortReceiver(parent),
    data(new PortIn<std::complex<float>>(this, -1)),
    addr(new PortIn<int>(this, -1)),
    pid(new PortIn<int>(this, -1)),
    sb_addr(new PortIn<int>(this, -1)),
    ain_addr(new PortIn<int>(this, -1)),
    clr(new PortIn<bool>(this, -1))
{
}

LaneChannelLoadFabricBusPack LaneChannelLoadFabricBusReceiver::get()
{
    LaneChannelLoadFabricBusPack tmp_884999728;
    tmp_884999728.data = data->get();
    tmp_884999728.addr = addr->get();
    tmp_884999728.pid = pid->get();
    tmp_884999728.sb_addr = sb_addr->get();
    tmp_884999728.ain_addr = ain_addr->get();
    tmp_884999728.clr = clr->get();
    return tmp_884999728;
}

bool LaneChannelLoadFabricBusReceiver::is_any_empty()
{
    return data->is_empty() || addr->is_empty() || pid->is_empty() || sb_addr->is_empty() || ain_addr->is_empty() || clr->is_empty();
}

bool LaneChannelLoadFabricBusReceiver::is_any_full()
{
    return data->is_full() || addr->is_full() || pid->is_full() || sb_addr->is_full() || ain_addr->is_full() || clr->is_full();
}

ChannelLoadFabricSender::ChannelLoadFabricSender(JObject *parent) :
    ChannelPortSender(parent),
     Bus(new LaneChannelLoadFabricBusSender(this))
{
}

ChannelLoadFabricReceiver::ChannelLoadFabricReceiver(JObject *parent) :
    ChannelPortReceiver(parent),
    Bus(new LaneChannelLoadFabricBusReceiver(this))
{
}

void ChannelLoadFabric::connect(ChannelLoadFabricSender *sender, ChannelLoadFabricReceiver *receiver)
{
    sender->Bus->connect(receiver->Bus);
}

LaneChannelLoadReqFabricBusSender::LaneChannelLoadReqFabricBusSender(JObject *parent) :
    LanePortSender(parent),
    mem_addr(new PortOut<int>(this)),
    pid(new PortOut<int>(this)),
    sm_addr(new PortOut<int>(this)),
    sb_addr(new PortOut<int>(this)),
    ain_addr(new PortOut<int>(this)),
    clr(new PortOut<bool>(this))
{
}

void LaneChannelLoadReqFabricBusSender::connect(LaneChannelLoadReqFabricBusReceiver *sender)
{
    mem_addr->connect(sender->mem_addr);
    pid->connect(sender->pid);
    sm_addr->connect(sender->sm_addr);
    sb_addr->connect(sender->sb_addr);
    ain_addr->connect(sender->ain_addr);
    clr->connect(sender->clr);
}

void LaneChannelLoadReqFabricBusSender::put(int data_mem_addr, int data_pid, int data_sm_addr, int data_sb_addr, int data_ain_addr, bool data_clr)
{
    mem_addr->put(data_mem_addr);
    pid->put(data_pid);
    sm_addr->put(data_sm_addr);
    sb_addr->put(data_sb_addr);
    ain_addr->put(data_ain_addr);
    clr->put(data_clr);
}

void LaneChannelLoadReqFabricBusSender::put_bypass(LaneChannelLoadReqFabricBusReceiver *receiver)
{
    mem_addr->put(receiver->mem_addr->get());
    pid->put(receiver->pid->get());
    sm_addr->put(receiver->sm_addr->get());
    sb_addr->put(receiver->sb_addr->get());
    ain_addr->put(receiver->ain_addr->get());
    clr->put(receiver->clr->get());
}

bool LaneChannelLoadReqFabricBusSender::is_any_full()
{
    return mem_addr->is_full() || pid->is_full() || sm_addr->is_full() || sb_addr->is_full() || ain_addr->is_full() || clr->is_full();
}

LaneChannelLoadReqFabricBusReceiver::LaneChannelLoadReqFabricBusReceiver(JObject *parent) :
    LanePortReceiver(parent),
    mem_addr(new PortIn<int>(this, -1)),
    pid(new PortIn<int>(this, -1)),
    sm_addr(new PortIn<int>(this, -1)),
    sb_addr(new PortIn<int>(this, -1)),
    ain_addr(new PortIn<int>(this, -1)),
    clr(new PortIn<bool>(this, -1))
{
}

LaneChannelLoadReqFabricBusPack LaneChannelLoadReqFabricBusReceiver::get()
{
    LaneChannelLoadReqFabricBusPack tmp_885001408;
    tmp_885001408.mem_addr = mem_addr->get();
    tmp_885001408.pid = pid->get();
    tmp_885001408.sm_addr = sm_addr->get();
    tmp_885001408.sb_addr = sb_addr->get();
    tmp_885001408.ain_addr = ain_addr->get();
    tmp_885001408.clr = clr->get();
    return tmp_885001408;
}

bool LaneChannelLoadReqFabricBusReceiver::is_any_empty()
{
    return mem_addr->is_empty() || pid->is_empty() || sm_addr->is_empty() || sb_addr->is_empty() || ain_addr->is_empty() || clr->is_empty();
}

bool LaneChannelLoadReqFabricBusReceiver::is_any_full()
{
    return mem_addr->is_full() || pid->is_full() || sm_addr->is_full() || sb_addr->is_full() || ain_addr->is_full() || clr->is_full();
}

ChannelLoadReqFabricSender::ChannelLoadReqFabricSender(JObject *parent) :
    ChannelPortSender(parent),
     Bus(new LaneChannelLoadReqFabricBusSender(this))
{
}

ChannelLoadReqFabricReceiver::ChannelLoadReqFabricReceiver(JObject *parent) :
    ChannelPortReceiver(parent),
    Bus(new LaneChannelLoadReqFabricBusReceiver(this))
{
}

void ChannelLoadReqFabric::connect(ChannelLoadReqFabricSender *sender, ChannelLoadReqFabricReceiver *receiver)
{
    sender->Bus->connect(receiver->Bus);
}

LaneChannelExecOpFabricBusSender::LaneChannelExecOpFabricBusSender(JObject *parent) :
    LanePortSender(parent),
    nano_op(new PortOut<ExecOp>(this))
{
}

void LaneChannelExecOpFabricBusSender::connect(LaneChannelExecOpFabricBusReceiver *sender)
{
    nano_op->connect(sender->nano_op);
}

void LaneChannelExecOpFabricBusSender::put(ExecOp data_nano_op)
{
    nano_op->put(data_nano_op);
}

void LaneChannelExecOpFabricBusSender::put_bypass(LaneChannelExecOpFabricBusReceiver *receiver)
{
    nano_op->put(receiver->nano_op->get());
}

bool LaneChannelExecOpFabricBusSender::is_any_full()
{
    return nano_op->is_full();
}

LaneChannelExecOpFabricBusReceiver::LaneChannelExecOpFabricBusReceiver(JObject *parent) :
    LanePortReceiver(parent),
    nano_op(new PortIn<ExecOp>(this, -1))
{
}

LaneChannelExecOpFabricBusPack LaneChannelExecOpFabricBusReceiver::get()
{
    LaneChannelExecOpFabricBusPack tmp_884996248;
    tmp_884996248.nano_op = nano_op->get();
    return tmp_884996248;
}

bool LaneChannelExecOpFabricBusReceiver::is_any_empty()
{
    return nano_op->is_empty();
}

bool LaneChannelExecOpFabricBusReceiver::is_any_full()
{
    return nano_op->is_full();
}

ChannelExecOpFabricSender::ChannelExecOpFabricSender(JObject *parent) :
    ChannelPortSender(parent),
     Bus(new LaneChannelExecOpFabricBusSender(this))
{
}

ChannelExecOpFabricReceiver::ChannelExecOpFabricReceiver(JObject *parent) :
    ChannelPortReceiver(parent),
    Bus(new LaneChannelExecOpFabricBusReceiver(this))
{
}

void ChannelExecOpFabric::connect(ChannelExecOpFabricSender *sender, ChannelExecOpFabricReceiver *receiver)
{
    sender->Bus->connect(receiver->Bus);
}

LaneChannelTranOpFabricBusSender::LaneChannelTranOpFabricBusSender(JObject *parent) :
    LanePortSender(parent),
    nano_op(new PortOut<TranOp>(this))
{
}

void LaneChannelTranOpFabricBusSender::connect(LaneChannelTranOpFabricBusReceiver *sender)
{
    nano_op->connect(sender->nano_op);
}

void LaneChannelTranOpFabricBusSender::put(TranOp data_nano_op)
{
    nano_op->put(data_nano_op);
}

void LaneChannelTranOpFabricBusSender::put_bypass(LaneChannelTranOpFabricBusReceiver *receiver)
{
    nano_op->put(receiver->nano_op->get());
}

bool LaneChannelTranOpFabricBusSender::is_any_full()
{
    return nano_op->is_full();
}

LaneChannelTranOpFabricBusReceiver::LaneChannelTranOpFabricBusReceiver(JObject *parent) :
    LanePortReceiver(parent),
    nano_op(new PortIn<TranOp>(this, -1))
{
}

LaneChannelTranOpFabricBusPack LaneChannelTranOpFabricBusReceiver::get()
{
    LaneChannelTranOpFabricBusPack tmp_884997032;
    tmp_884997032.nano_op = nano_op->get();
    return tmp_884997032;
}

bool LaneChannelTranOpFabricBusReceiver::is_any_empty()
{
    return nano_op->is_empty();
}

bool LaneChannelTranOpFabricBusReceiver::is_any_full()
{
    return nano_op->is_full();
}

ChannelTranOpFabricSender::ChannelTranOpFabricSender(JObject *parent) :
    ChannelPortSender(parent),
     Bus(new LaneChannelTranOpFabricBusSender(this))
{
}

ChannelTranOpFabricReceiver::ChannelTranOpFabricReceiver(JObject *parent) :
    ChannelPortReceiver(parent),
    Bus(new LaneChannelTranOpFabricBusReceiver(this))
{
}

void ChannelTranOpFabric::connect(ChannelTranOpFabricSender *sender, ChannelTranOpFabricReceiver *receiver)
{
    sender->Bus->connect(receiver->Bus);
}